package com.xianrenit.xianrenpuzi.manager.service.impl;

import com.xianrenit.xianrenpuzi.manager.mapper.ProductSpecMapper;
import com.xianrenit.xianrenpuzi.manager.service.ProductSpecService;
import com.xianrenit.xianrenpuzi.model.entity.product.ProdcutSpec;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProductSpecServiceImpl implements ProductSpecService {
    @Resource
    ProductSpecMapper productSpecMapper;
    @Override
    public List<ProdcutSpec> listAll() {
        return productSpecMapper.selectAll();
    }

    @Override
    public ProdcutSpec getById(Long id) {
        return productSpecMapper.selectById(id);
    }

    @Override
    public void update(ProdcutSpec prodcutSpec) {
        productSpecMapper.update(prodcutSpec);
    }

    @Override
    public void save(ProdcutSpec prodcutSpec) {
        productSpecMapper.save(prodcutSpec);
    }

    @Override
    public void deleteById(Long id) {
        productSpecMapper.deleteById(id);
    }

    @Override
    public PageInfo<ProdcutSpec> list(Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<ProdcutSpec> list = productSpecMapper.selectAll();
        return new PageInfo<>(list);
    }
}
